<template>
	<view :class="{'flex-flow':flexFlow}" class="chat-item">
		<view class="chat-head" @click="callFatherMethod(customData.userId)">
			<image :src="customData.avatar" mode="aspectFill"></image>
		</view>
		<view class="chat-wxbox">
			<view class="chat-tit">
				<view class="tit-head">
					<image :src="ossPath+`/chat/wx.png`" mode="aspectFill"></image>
				</view>
				<view class="tit-text">
					对方想要添加您的微信，您是否同意？
				</view>
			</view>
			<view class="chat-btn" v-if="isFriendCheck(customData.message.messageID,'wx')">
				<view class="btn-item" @click="wxSub(99)">
					拒绝
				</view>
				|
				<view class="btn-item" style="color: #111;"
					@click="wxSub(1)">
					同意
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "chatBeApplyWx",
		props: {
			flexFlow: {
				type: Boolean,
				default: true,
			},
			customData: {
				type: Object,
				default: {
					avatar:'',
					userId:0,
					message:{
						messageID:0,
						EventID:0,
						msgIndex:0,
					}
				},
			}
		},
		data() {
			return {
				ossPath : "",
			};
		},
		created() {

		},
		mounted() {
			this.ossPath = this.$ossPath;
		},
		methods: {
			isFriendCheck(msgId,type){
					if(type=='friends') return !((uni.getStorageSync('friends_') || []).some(item=>item.msgId==msgId))
					if(type=='wx') return !((uni.getStorageSync('wx_') || []).some(item=>item.msgId==msgId))
			},
			callFatherMethod(){
				this.$emit('callFatherMethod',this.customData.userId)
			},
			callFatherMethod2(status){
				this.$emit('callFatherMethod2',status,this.customData.msgIndex,this.customData.message.EventID,this.customData.message.messageID)
			}
		},
	};
</script>

<style lang="scss" scoped>


</style>